import { Injectable, Inject } from '@angular/core';
import { HttpClient, HttpParams, HttpHeaders } from '@angular/common/http';

import { Observable } from 'rxjs/Observable';

import { User } from '../models/index';
// import { Header } from 'primeng/primeng';

@Injectable()
export class LoginService {

  //  url1 = "http://yyg.server.cloudansys.cn:8080/api/";
  

  constructor(private http: HttpClient, @Inject('API_URL') private url: string) { }

  
  login(username: string, password: string): Observable<User> {
    const url1 = `${this.url}security/login`;
    console.log(999,url1)
    const headers = new HttpHeaders()
      .set('Content-Type', 'application/x-www-form-urlencoded');
    const params = new HttpParams()
      .set('username', username)
      .set('password', password);
    return this.http
      .post(url1, params, { headers: headers })
  }

   
 


}
